//
//  JTWebViewController.m
//  百思不得姐
//
//  Created by Robin Zhang on 2016/12/27.
//  Copyright © 2016年 BeiJingWangDianJieTong. All rights reserved.
//

#import "JTWebViewController.h"

@interface JTWebViewController () <UIWebViewDelegate>

@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *backItem;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *forwardItem;

@end

@implementation JTWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
}

#pragma mark - <UIWebViewDelegate>
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    [self.backItem setEnabled:webView.canGoBack];
    [self.forwardItem setEnabled:webView.canGoForward];
}

#pragma mark - 监听点击
- (IBAction)reload:(UIBarButtonItem *)sender {
    
    [self.webView reload];
}

- (IBAction)back:(UIBarButtonItem *)sender {
    
    [self.webView goBack];
}

- (IBAction)forward:(UIBarButtonItem *)sender {
    
    [self.webView goForward];
}

@end
